CC = gcc
CFLAGS=-O -Wall
COMPILE= $(CC) $(CFLAGS) -c
OBJFILES := $(patsubst %.c,%.o,$(wildcard *.c))

all: rtree test

clean:
	-rm *.o
	-rm rtree_harness

pullfiles:
	cp ../cmap*.* .
	cp ../radixtree*.* .
	cp ../tagm*.* .

rtree: $(OBJFILES)
	$(CC) $(CFLAGS) -o rtree_harness $(OBJFILES)

test: rtree
	-rm test.rt
	./rtree_harness -f test.rt -o put -k "a key value" -v "a data value"
	./rtree_harness -f test.rt -o get -k "a key value" -v "a data value"
	./rtree_harness -f test.rt -o del -k "a key value" -v ""
	./rtree_harness -f test.rt -o put -k "value1" -v "a data value 1"
	./rtree_harness -f test.rt -o put -k "value2" -v "a data value 2"
	./rtree_harness -f test.rt -o put -k "value3" -v "a data value 3"
	./rtree_harness -f test.rt -o put -k "val" -v "a data value 4"
	./rtree_harness -f test.rt -o dump -k "" -v ""
	
%.o: %.cpp
	$(COMPILE) -o $@ $<